# coding:utf-8
# 事件
#import DATA_HangUp
import gtimer


class Event(object):
	def __init__(self):
		
		self.id = 0
		self.role_id = 0
		self.type = 0	# 事件类型
#		self.start_time = 0

		self.timer = -1


	# 转化成字典数据
	def to_dictonary(self):
		import copy
		return copy.deepcopy(self.__dict__) # 类比较干净,直接传__dict__就行了

		
	def get_desc(self):
		return DATA_HangUp.data[self.type]['desc']


	def start(self):
		print "================= start"
		self.timer = gtimer.create_timer(5, self.on_timer)


	def on_timer(self):
		print "on_timer"


	def stop(self):
		print "================= stop"
		gtimer.stop_timer(self.timer)


	def __repr__(self):
		return "<event.Event('%s')>" % (self.get_desc())











